home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / DesktopDoubler / Common / Sources / QDUtils.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1999-06-25  |  1.5 KB  |  94 lines  |  [TEXT/CWIE]

  1. #define DISABLE_LOCAL_CALLTRACE        1        // Set to 1 to disable Call Traces for this file.
  2. #define DISABLE_LOCAL_DEBUG            0        // Set to 1 to disable all debugging for this file.
  3. #include "DebugUtils.h"
  4.  
  5. #include "QDUtils.h"
  6.  
  7.  
  8.  
  9.  
  10.  
  11. QDContext::QDContext(void)
  12. {
  13.     GetPort(&fSavePort);
  14.     
  15.     fPenSize = fSavePort->pnSize;
  16.     fPenMode = fSavePort->pnMode;
  17.     fPenPat = fSavePort->pnPat;
  18.     fTextFont = fSavePort->txFont;
  19.     fTextFace = fSavePort->txFace;
  20.     fTextMode = fSavePort->txMode;
  21.     fTextSize = fSavePort->txSize;
  22.     GetForeColor(&fForeColor);
  23.     GetBackColor(&fBackColor);
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
  30. QDContext::QDContext(GrafPtr port)
  31. {
  32.     GetPort(&fSavePort);
  33.     
  34.     fPenSize = fSavePort->pnSize;
  35.     fPenMode = fSavePort->pnMode;
  36.     fPenPat = fSavePort->pnPat;
  37.     fTextFont = fSavePort->txFont;
  38.     fTextFace = fSavePort->txFace;
  39.     fTextMode = fSavePort->txMode;
  40.     fTextSize = fSavePort->txSize;
  41.     GetForeColor(&fForeColor);
  42.     GetBackColor(&fBackColor);
  43.     
  44.     SetPort((GrafPtr)port);
  45. }
  46.  
  47.  
  48.  
  49.  
  50.  
  51. QDContext::~QDContext(void)
  52. {
  53.     SetPort(fSavePort);
  54.     
  55.     PenSize(fPenSize.h,fPenSize.v);
  56.     PenMode(fPenMode);
  57.     PenPat(&fPenPat);
  58.     TextFont(fTextFont);
  59.     TextFace(fTextFace);
  60.     TextMode(fTextMode);
  61.     TextSize(fTextSize);
  62.     RGBForeColor(&fForeColor);
  63.     RGBBackColor(&fBackColor);
  64. }
  65.  
  66.  
  67.  
  68.  
  69.  
  70. QDClipContext::QDClipContext(GrafPtr port,RgnHandle clip)
  71. {
  72.     QDContext    context(port);
  73.     
  74.     
  75.     fSavePort = port;
  76.     fSaveClip = NewRgn();
  77.     
  78.     GetClip(fSaveClip);
  79.     SetClip(clip);
  80. }
  81.  
  82.  
  83.  
  84.  
  85.  
  86. QDClipContext::~QDClipContext(void)
  87. {
  88.     QDContext    context(fSavePort);
  89.     
  90.     
  91.     SetClip(fSaveClip);
  92.     DisposeRgn(fSaveClip);
  93. }
  94.